//
//  ContactManager.m
//  04-集合(二)
//
//  Created by 402030900@qq.com on 16/7/7.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "ContactManager.h"

@implementation ContactManager
-(instancetype)initWithDictionary:(NSMutableDictionary *)dictionary{
    self = [super init];
    if (self) {
        _ContactMuDic = dictionary;
    }
    return self;
}
-(void)addContact:(Contact *)contact{
    if (contact.name.length > 0 && contact.tel.length > 0) {
        NSMutableArray * contactArr = [_ContactMuDic objectForKey:contact.groupName];
        if (contactArr == nil) {
            contactArr = [NSMutableArray arrayWithObject:contact];
            [_ContactMuDic setObject:contactArr forKey:contact.groupName];
        }
        NSLog(@"添加联系人%@成功",contact.name);
    }else{
        NSLog(@"添加联系人%@失败",contact.name);
    }
}
-(void)removeContact:(Contact *)contact{
}
-(void)removeGroupWithGroupName:(NSString *)groupName{
    [_ContactMuDic removeObjectForKey:groupName];
}

@end
